
#include <iostream>
#include <pthread.h>
#include <unistd.h>

void *threadStart(void *args)
{
    while (true)
    {
        std::cout << "new thread running ... pid: " << getpid() << std::endl;
        sleep(1);
    }
}

int main()
{
    pthread_t tid;
    pthread_create(&tid, nullptr, threadStart, (void *)"thread-new");

    // 主线程继续向下执行
    while (true)
    {
        sleep(1);
        std::cout << "main thread running ... pid: " << getpid() << std::endl;
    }
    
    return 0;
}
